import react, { Component } from 'react';
import { bindActionCreators } from 'redux'
import { connect } from 'dva';

//import { Table,Button } from 'antd';

class IndexPage extends Component {
  constructor(props) {
    super(props);
    this.state = {
      prod: ['苹果']
    }
    console.log(props);
  }
  aa = () => {

  }
  render() {
    return (<div>
      {this.props.cat.name}
      <input type="button" value="改名" onClick={(name) => this.props.changeNameSync('王麻子')} />
      {/* <Button type="primary">NEW</Button> */}
    </div>);
  }
}

IndexPage.propTypes = {
};

const mdp = (d) => {
  return {
    changeName(name) {
      setTimeout(() => {
        d({ type: 'cat/changeName', payload: name })
      }, 2000);
    },
    changeNameSync(name) {
      d({ type: 'cat/changeNameSync', payload: name })
    }
  }
}
export default connect(s => { return { cat: s.cat } }, mdp)(IndexPage);
